<?php

/**
 * BonCommandeFournisseur filter form base class.
 *
 * @package    SdCommerce
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseBonCommandeFournisseurFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'duree_validite'               => new sfWidgetFormFilterInput(),
      'date_piece'                   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'date_livraison'               => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'reference_piece'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'observation'                  => new sfWidgetFormFilterInput(),
      'date_echeance'                => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'id_modepaiement'              => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ModalitePaiement'), 'add_empty' => true)),
      'echance_cb'                   => new sfWidgetFormChoice(array('choices' => array('' => '', 'Jours' => 'Jours', 'Semaines' => 'Semaines', 'Mois' => 'Mois', 'Années' => 'Années'))),
      'id_fournisseur'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Fournisseur'), 'add_empty' => true)),
      'duree_echance'                => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'valider'                      => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'id_departement'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'add_empty' => true)),
      'bon_livraison_fournisseur_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('BonLivraisonFournisseur'), 'add_empty' => true)),
      'created_at'                   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'                   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'duree_validite'               => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'date_piece'                   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'date_livraison'               => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'reference_piece'              => new sfValidatorPass(array('required' => false)),
      'observation'                  => new sfValidatorPass(array('required' => false)),
      'date_echeance'                => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'id_modepaiement'              => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('ModalitePaiement'), 'column' => 'id')),
      'echance_cb'                   => new sfValidatorChoice(array('required' => false, 'choices' => array('Jours' => 'Jours', 'Semaines' => 'Semaines', 'Mois' => 'Mois', 'Années' => 'Années'))),
      'id_fournisseur'               => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Fournisseur'), 'column' => 'id')),
      'duree_echance'                => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'valider'                      => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'id_departement'               => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Departement'), 'column' => 'id')),
      'bon_livraison_fournisseur_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('BonLivraisonFournisseur'), 'column' => 'id')),
      'created_at'                   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'                   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('bon_commande_fournisseur_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'BonCommandeFournisseur';
  }

  public function getFields()
  {
    return array(
      'id'                           => 'Number',
      'duree_validite'               => 'Number',
      'date_piece'                   => 'Date',
      'date_livraison'               => 'Date',
      'reference_piece'              => 'Text',
      'observation'                  => 'Text',
      'date_echeance'                => 'Date',
      'id_modepaiement'              => 'ForeignKey',
      'echance_cb'                   => 'Enum',
      'id_fournisseur'               => 'ForeignKey',
      'duree_echance'                => 'Number',
      'valider'                      => 'Boolean',
      'id_departement'               => 'ForeignKey',
      'bon_livraison_fournisseur_id' => 'ForeignKey',
      'created_at'                   => 'Date',
      'updated_at'                   => 'Date',
    );
  }
}
